/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * plantilla.java
 *
 * Created on 31/10/2011, 12:00:51 AM
 */
package vista.panel.altas;

import controlador.EventoBoton;
import controlador.Listar;
import logica.OperacionBaseDatos;
import modelo.Productor;

/**
 *
 * @author Elias Mendoza
 */
public class AltaProductor extends javax.swing.JPanel {
    EventoBoton eb;

  /** Creates new form plantilla */
  public AltaProductor() {
    initComponents();
    eb = new EventoBoton();
  }

  /** This method is called from within the constructor to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panel2 = new javax.swing.JPanel();
        jSplitPane1 = new javax.swing.JSplitPane();
        jLabel1 = new javax.swing.JLabel();
        nombre = new javax.swing.JTextField();
        jSplitPane2 = new javax.swing.JSplitPane();
        jLabel2 = new javax.swing.JLabel();
        email = new javax.swing.JTextField();
        jSplitPane3 = new javax.swing.JSplitPane();
        jLabel3 = new javax.swing.JLabel();
        dependencia = new javax.swing.JTextField();
        jSplitPane5 = new javax.swing.JSplitPane();
        jLabel5 = new javax.swing.JLabel();
        direccion = new javax.swing.JTextField();
        jSplitPane4 = new javax.swing.JSplitPane();
        jLabel4 = new javax.swing.JLabel();
        telefono = new javax.swing.JTextField();
        jSplitPane7 = new javax.swing.JSplitPane();
        jLabel6 = new javax.swing.JLabel();
        telCasa = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        jSplitPane6 = new javax.swing.JSplitPane();
        registrar = new javax.swing.JButton();
        borra = new javax.swing.JButton();

        setBackground(new java.awt.Color(255, 255, 255));
        setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Registrar Productor", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Maiandra GD", 1, 14))); // NOI18N

        panel2.setBackground(new java.awt.Color(255, 255, 255));
        panel2.setLayout(new java.awt.GridLayout(4, 0, 20, 10));

        jSplitPane1.setBackground(new java.awt.Color(255, 255, 255));
        jSplitPane1.setBorder(null);
        jSplitPane1.setDividerSize(0);
        jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

        jLabel1.setBackground(new java.awt.Color(255, 255, 255));
        jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel1.setForeground(new java.awt.Color(0, 153, 102));
        jLabel1.setText("Nombre:");
        jSplitPane1.setLeftComponent(jLabel1);

        nombre.setFont(new java.awt.Font("Times New Roman", 1, 12));
        jSplitPane1.setRightComponent(nombre);

        panel2.add(jSplitPane1);

        jSplitPane2.setBackground(new java.awt.Color(255, 255, 255));
        jSplitPane2.setBorder(null);
        jSplitPane2.setDividerSize(0);
        jSplitPane2.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

        jLabel2.setBackground(new java.awt.Color(204, 255, 255));
        jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel2.setForeground(new java.awt.Color(0, 153, 102));
        jLabel2.setText("e-mail:");
        jSplitPane2.setLeftComponent(jLabel2);

        email.setFont(new java.awt.Font("Times New Roman", 1, 12));
        jSplitPane2.setRightComponent(email);

        panel2.add(jSplitPane2);

        jSplitPane3.setBackground(new java.awt.Color(255, 255, 255));
        jSplitPane3.setBorder(null);
        jSplitPane3.setDividerSize(0);
        jSplitPane3.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

        jLabel3.setBackground(new java.awt.Color(204, 255, 255));
        jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel3.setForeground(new java.awt.Color(0, 153, 102));
        jLabel3.setText("Dependencia:");
        jSplitPane3.setLeftComponent(jLabel3);

        dependencia.setFont(new java.awt.Font("Times New Roman", 1, 12));
        jSplitPane3.setRightComponent(dependencia);

        panel2.add(jSplitPane3);

        jSplitPane5.setBackground(new java.awt.Color(255, 255, 255));
        jSplitPane5.setBorder(null);
        jSplitPane5.setDividerSize(0);
        jSplitPane5.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

        jLabel5.setBackground(new java.awt.Color(204, 255, 255));
        jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jLabel5.setForeground(new java.awt.Color(0, 153, 102));
        jLabel5.setText("Dirección:");
        jSplitPane5.setLeftComponent(jLabel5);

        direccion.setFont(new java.awt.Font("Times New Roman", 1, 12));
        jSplitPane5.setRightComponent(direccion);

        panel2.add(jSplitPane5);

        jSplitPane4.setBackground(new java.awt.Color(255, 255, 255));
        jSplitPane4.setBorder(null);
        jSplitPane4.setDividerSize(0);
        jSplitPane4.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

        jLabel4.setBackground(new java.awt.Color(204, 255, 255));
        jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(0, 153, 102));
        jLabel4.setText("Telefono (Movil):");
        jSplitPane4.setLeftComponent(jLabel4);

        telefono.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jSplitPane4.setRightComponent(telefono);

        panel2.add(jSplitPane4);

        jSplitPane7.setBackground(new java.awt.Color(255, 255, 255));
        jSplitPane7.setBorder(null);
        jSplitPane7.setDividerSize(0);
        jSplitPane7.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

        jLabel6.setBackground(new java.awt.Color(204, 255, 255));
        jLabel6.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
        jLabel6.setForeground(new java.awt.Color(0, 153, 102));
        jLabel6.setText("Telefono (Casa):");
        jSplitPane7.setLeftComponent(jLabel6);

        telCasa.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N
        jSplitPane7.setRightComponent(telCasa);

        panel2.add(jSplitPane7);

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setLayout(new java.awt.GridBagLayout());

        jSplitPane6.setBackground(new java.awt.Color(255, 255, 255));
        jSplitPane6.setBorder(null);

        registrar.setBackground(new java.awt.Color(255, 255, 255));
        registrar.setFont(new java.awt.Font("Maiandra GD", 1, 14)); // NOI18N
        registrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/registrar.png"))); // NOI18N
        registrar.setBorder(null);
        registrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                registrarActionPerformed(evt);
            }
        });
        jSplitPane6.setLeftComponent(registrar);

        borra.setBackground(new java.awt.Color(255, 255, 255));
        borra.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/borrar.png"))); // NOI18N
        borra.setBorder(null);
        borra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                borraActionPerformed(evt);
            }
        });
        jSplitPane6.setRightComponent(borra);

        jPanel1.add(jSplitPane6, new java.awt.GridBagConstraints());

        panel2.add(jPanel1);

        add(panel2);
    }// </editor-fold>//GEN-END:initComponents

  private void borraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_borraActionPerformed
    // TODO add your handling code here:
  }//GEN-LAST:event_borraActionPerformed

  private void registrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_registrarActionPerformed
    // TODO add your handling code here:
    Productor p = new Productor();
    p.setDependencia(dependencia.getText());
    p.setDireccion(direccion.getText());
    p.setEmail(email.getText());
    p.setNombre(nombre.getText());
    p.setTelefono(telefono.getText());
    eb.insertarFormulario(p);
  }//GEN-LAST:event_registrarActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton borra;
    private javax.swing.JTextField dependencia;
    private javax.swing.JTextField direccion;
    private javax.swing.JTextField email;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JSplitPane jSplitPane2;
    private javax.swing.JSplitPane jSplitPane3;
    private javax.swing.JSplitPane jSplitPane4;
    private javax.swing.JSplitPane jSplitPane5;
    private javax.swing.JSplitPane jSplitPane6;
    private javax.swing.JSplitPane jSplitPane7;
    private javax.swing.JTextField nombre;
    private javax.swing.JPanel panel2;
    private javax.swing.JButton registrar;
    private javax.swing.JTextField telCasa;
    private javax.swing.JTextField telefono;
    // End of variables declaration//GEN-END:variables
}
